
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>生成配送员配费明细</title>
</head>
<body>
<div ng-app="UploadFileApp" ng-controller="UploadFileCtrl">
    <div class="row">
        <div class="col-md-6">
            <div class="col-md-2">
                <label>选择月份</label>
            </div>
            <div class="col-md-3">
                <input class="form-control" type="text"  id="datetimepicker" readonly >
            </div>
            <div class="col-md-3">
                <a class="btn btn-sm btn-primary" ng-click="doUpload()" id="confire">确认生成</a><br/>
                <%--<a class="btn btn-sm btn-primary" ng-click="rePullData()" id="rePullLogisticsData">运单数据重拉</a>--%>
            </div>
        </div>
    </div>
</div>
<script>
    angular.module('UploadFileApp',[])
        .controller('UploadFileCtrl', function($scope) {
            $("#datetimepicker").datetimepicker({
                startView: 'year',
                viewSelect: 'year',
                minView: 'year',
                format: 'yyyy-mm',
                autoclose: true,
                todayBtn: true,
                pickerPosition: "bottom-left"
            });
            $scope.doUpload = function () {
                $("#confire").attr('disabled', true);
                var value = $("#datetimepicker").val();
                $.ajax({
                    url: 'report/uploadfile/generate',
                    data: {salaryMonth: value},
                    type: 'post',
                    async: false,
                    success: function (result) {
                        if (result.code == '0000') {
                            toastr.success("生成成功");
                            $("#confire").attr('disabled', false);
                        } else if(result.code == '0022') {{
                            toastr.error("生成失败," + result.msg);
                            $("#confire").attr('disabled', false);
                        }
                        }else {
                            toastr.error("生成失败," + result.msg);
                            $("#confire").attr('disabled', false);
                        }
                    },
                    error: function () {
                        toastr.error("服务器异常");
                        $("#confire").attr('disabled', false);

                    }
                })
                }
            });


</script>
</body>
</html>
